package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.SystemLog;
import cn.wolfcode.crm.mapper.SystemLogMapper;
import cn.wolfcode.crm.service.ISystemLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SystemLogServiceImpl implements ISystemLogService {
    @Autowired
    private SystemLogMapper systemLogMapper;

    public void saveOrUpdate(SystemLog entity) {
        if (entity.getId() == null) {
            systemLogMapper.insert(entity);
        } else {
            systemLogMapper.updateByPrimaryKey(entity);
        }
    }

    public void delete(Long id) {
        systemLogMapper.deleteByPrimaryKey(id);
    }

    public SystemLog get(Long id) {
        return systemLogMapper.selectByPrimaryKey(id);
    }

    public List<SystemLog> listAll() {
        return systemLogMapper.selectAll();
    }

//    @Override
//    public PageResult query(QueryObject qo) {
//        int count = systemLogMapper.queryCount(qo);
//        if (count == 0) {
//            return new PageResult(0, Collections.emptyList());
//        }
//        List<SystemLog> systemLogs = systemLogMapper.queryList(qo);
//        return new PageResult(count, systemLogs);
//    }

}
